/**
* 人员档案通用模板
*/
<template>
  <el-form v-loading="loading" :model="formData" :rules="isEditPage ? formRules : {}" ref="formRef" label-width="120px"
    :scroll-to-error="true">
    <vp-card v-if="type!='editQulity'">
      <el-row>
        <el-row style="flex: 1;">
          <vp-col :span="3">
            <el-form-item prop="bh">
              <template #label><vp-label zh="编号" en="Number" align="left" /></template>
              <el-input v-model="formData.bh" v-trim maxlength="100" v-if="isEditPage"></el-input>
              <span v-else>{{ formData.bh }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="xm">
              <template #label><vp-label zh="姓名" en="Name" align="left" /></template>
              <el-input v-model="formData.xm" :readonly="(formData.yhid != '')" v-if="isEditPage">
                <template #append>
                  <el-button @click="chooseUserHandle">
                    <SvgIcon name="ele-Search" />
                  </el-button>
                </template>
              </el-input>
              <span v-else>{{ formData.xm }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="nwbs">
              <template #label><vp-label zh="内/外" en="Int./Ext." align="left" /></template>
              <el-radio-group v-model="formData.nwbs" v-if="isEditPage">
                <el-radio :label="10" :key="10">{{ "内/Int." }}</el-radio>
                <el-radio :label="20" :key="20">{{ '外/Ext.' }}</el-radio>
              </el-radio-group>
              <span v-else>{{ formData.nwbs == 10 ? "内/Inside" : formData.nwbs == 20 ? "外/External" : "" }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="csrq">
              <template #label><vp-label zh="出生日期" en="Birthday" align="left" /></template>
              <el-date-picker style="width:100%" v-model="formData.csrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ formData.csrq }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="xb">
              <template #label><vp-label zh="性别" en="Gender" align="left" /></template>
              <el-radio-group v-model="formData.xb" v-if="isEditPage">
                <el-radio :label="10" :key="10">{{ "男/Male" }}</el-radio>
                <el-radio :label="20" :key="20">{{ '女/Female' }}</el-radio>
              </el-radio-group>
              <span v-else>{{ formData.xb == 10 ? "男/Male" : formData.xb == 20 ? "女/Female" : "" }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="hyzk">
              <template #label><vp-label zh="婚姻状况" en="Marital Status" align="left" /></template>
              <el-radio-group v-model="formData.hyzk" v-if="isEditPage">
                <el-radio :label="10" :key="10">{{ "已婚/Married" }}</el-radio>
                <el-radio :label="20" :key="20">{{ '未婚/Single' }}</el-radio>
              </el-radio-group>
              <span v-else>{{ formData.hyzk == 10 ? "已婚/Married" : formData.hyzk == 20 ? "未婚/Single" : "" }}</span>
            </el-form-item>
          </vp-col>

          <vp-col :span="3">
            <el-form-item prop="gj">
              <template #label><vp-label zh="国籍" en="Nationality" align="left" /></template>
              <el-input v-model="formData.gj" v-trim maxlength="100" v-if="isEditPage"></el-input>
              <span v-else>{{ formData.gj }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="zzmm">
              <template #label><vp-label zh="政治面貌" en="Political" align="left" /></template>
              <VpDictSelect :lxid="610" :selectedId="formData.zzmm" @dictSelected="obj => { formData.zzmm = obj; }"
                style="width:100%" v-if="isEditPage">
              </VpDictSelect>
              <span v-else>{{ formData.zzmm }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="lxdh">
              <template #label><vp-label zh="联系电话" en="Telephone" align="left" /></template>
              <el-input v-model="formData.lxdh" v-trim maxlength="20" v-if="isEditPage"></el-input>
              <span v-else>{{ formData.lxdh }}</span>
            </el-form-item>
          </vp-col>

          <vp-col :span="3">
            <el-form-item prop="xl">
              <template #label><vp-label zh="学历" en="Edu. Lv." align="left" /></template>
              <VpDictSelect :lxid="604" :selectedId="formData.xl" @dictSelected="obj => { formData.xl = obj; }"
                style="width:100%" v-if="isEditPage">
              </VpDictSelect>
              <span v-else>{{ formData.xl }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="xw">
              <template #label><vp-label zh="学位" en="Degree" align="left" /></template>
              <VpDictSelect :lxid="605" :selectedId="formData.xw" @dictSelected="obj => { formData.xw = obj; }"
                style="width:100%" v-if="isEditPage">
              </VpDictSelect>
              <span v-else>{{ formData.xw }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="yydj">
              <template #label><vp-label zh="英语等级" en="Public  Eng. Lv." align="left" /></template>
              <VpDictSelect :lxid="606" :selectedId="formData.yydj" @dictSelected="obj => { formData.yydj = obj; }"
                style="width:100%" v-if="isEditPage">
              </VpDictSelect>
              <span v-else>{{ formData.yydj }}</span>
            </el-form-item>
          </vp-col>

          <vp-col :span="3">
            <el-form-item prop="sfzh">
              <template #label><vp-label zh="身份证号" en="ID No." align="left" /></template>
              <el-input v-model="formData.sfzh" v-trim maxlength="20" v-if="isEditPage"></el-input>
              <span v-else>{{ formData.sfzh }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="zc">
              <template #label><vp-label zh="职称" en="Prof. Title" align="left" /></template>
              <VpDictSelect :lxid="608" :selectedId="formData.zc" @dictSelected="obj => { formData.zc = obj; }"
                style="width:100%" v-if="isEditPage">
              </VpDictSelect>
              <span v-else>{{ formData.zc }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="xrzw">
              <template #label><vp-label zh="现任职务" en="Curr. Position" align="left" /></template>
              <el-input v-model="formData.xrzw" v-trim maxlength="20" v-if="isEditPage"></el-input>
              <span v-else>{{ formData.xrzw }}</span>
            </el-form-item>
          </vp-col>


          <vp-col :span="2">
            <el-form-item prop="bm">
              <template #label><vp-label zh="部门" en="Dept." align="left" /></template>
              <el-input v-model="formData.bm" readonly v-if="isEditPage">
                <template #append>
                  <el-button @click="chooseDepartment">
                    <SvgIcon name="ele-Search" />
                  </el-button>
                </template>
              </el-input>
              <span v-else>{{ formData.bm }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="2">
            <el-form-item prop="jdid">
              <template #label><vp-label zh="基地" en="Base." align="left" /></template>
              <VpBaseSelectTree :selectedId="formData.jdid" :disabled="!(isEditPage)" @treeSelected="handleBaseSelected"
                class="w100">
              </VpBaseSelectTree>
            </el-form-item>
          </vp-col>


          <vp-col :span="3">
            <el-form-item prop="cjgzrq">
              <template #label><vp-label zh="参加工作日期" en="Start Work Date" align="left" /></template>
              <el-date-picker style="width:100%" v-model="formData.cjgzrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ formData.cjgzrq }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="rhrq">
              <template #label><vp-label zh="入行日期" en="Industry Entry Date" align="left" /></template>
              <el-date-picker style="width:100%" v-model="formData.rhrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ formData.rhrq }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item>
              <template #label><vp-label zh="维修经历" en="Maint. Exp." align="left" /></template>
              <span>{{ wxjlYear }}年</span>
            </el-form-item>
          </vp-col>

          <vp-col :span="3">
            <el-form-item prop="rzrq">
              <template #label><vp-label zh="入职日期" en="Employment Date" align="left" /></template>
              <el-date-picker style="width:100%" v-model="formData.rzrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ formData.rzrq }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="lzrq">
              <template #label><vp-label zh="离职日期" en="Resignation Date" align="left" /></template>
              <el-date-picker style="width:100%" v-model="formData.lzrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ formData.lzrq }}</span>
            </el-form-item>
          </vp-col>
          <vp-col :span="3">
            <el-form-item prop="zzzt">
              <template #label><vp-label zh="在职状态" en="Employed Status" align="left" /></template>
              <el-radio-group v-model="formData.zzzt" v-if="isEditPage">
                <el-radio :label="10" :key="10">{{ "在职/Employed" }}</el-radio>
                <el-radio :label="20" :key="20">{{ '离职/Unemployed' }}</el-radio>
              </el-radio-group>
              <span v-else>{{ formData.zzzt == 10 ? "在职/Employed" : formData.zzzt == 20 ? "离职/Unemployed" : "" }}</span>
            </el-form-item>
          </vp-col>

          <vp-col :span="2">
            <el-form-item prop="acTypeJxpxList">
              <template #label><vp-label zh="机型培训" en="AC Type Training" align="left" /></template>
              <el-input v-if="isEditPage" v-model="formData.acTypeJxpxList" v-trim readonly>
                <template #append>
                  <el-button @click="handleChooseBaseDataModelMult(1)">
                    <SvgIcon name="ele-Search" />
                  </el-button>
                </template>
              </el-input>
              <span v-else>
                <el-tag v-for="(item, index) in formData.acTypeJxpxList" :key="index">
                  {{ item }}
                </el-tag>
              </span>
            </el-form-item>
          </vp-col>
          <vp-col :span="2">
            <el-form-item prop="acTypeJxqsList">
              <template #label><vp-label zh="机型签署" en="AC  Type Endorsement" align="left" /></template>
              <el-input v-if="isEditPage" v-model="formData.acTypeJxqsList" v-trim readonly>
                <template #append>
                  <el-button @click="handleChooseBaseDataModelMult(2)">
                    <SvgIcon name="ele-Search" />
                  </el-button>
                </template>
              </el-input>
              <span v-else>
                <el-tag v-for="(item, index) in formData.acTypeJxqsList" :key="index">
                  {{ item }}
                </el-tag>
              </span>
            </el-form-item>
          </vp-col>

          <vp-col :span="1">
            <el-form-item prop="bz">
              <template #label><vp-label zh="备注" en="remark" align="left" /></template>
              <el-input type="textarea" v-model="formData.bz" v-trim maxlength="1000" v-if="isEditPage"></el-input>
              <span v-else style="white-space:pre">{{ formData.bz }}</span>
            </el-form-item>
          </vp-col>

        </el-row>
        <div style="width: 200px;display: flex;align-items: start;justify-content: center;margin-top: 80px;">
          <div class="pics">
            <el-upload action="" ref='uploadList' :before-upload="beforeUploadImg" :show-file-list="false"
              accept=".jpg,.png,.jpeg" v-if="isEditPage">
              <img :src="'data:image/png;base64,' + formData.zp.base64" alt="" style="width: 100px;height: 100px;"
                v-if="formData.zp.base64">
              <img src="/@/images/pic19.png" alt="" style="width: 100px;height: 100px;" v-else-if="!formData.zp.base64">
            </el-upload>
            <img :src="'data:image/png;base64,' + formData.zp.base64" alt="" style="width: 100px;height: 100px;"
              v-if="formData.zp.base64 && type == 'view'">
            <img src="/@/images/pic19.png" alt="" style="width: 100px;height: 100px;"
              v-else-if="!formData.zp.base64 && type == 'view'">
            <SvgIcon name="ele-Close" style="font-size: 14px;" @click="removePicture"
              v-if="formData.zp.base64 && (isEditPage)">
            </SvgIcon>
          </div>
        </div>
      </el-row>
    </vp-card>
    <vp-card>
      <template #header><vp-label zh="教育经历" en="Education Experience" /></template>
      <el-row>
        <vp-table :data="formData.eduList" style="flex:2;margin-left: 10px;height: 255px;overflow-y: auto;"
          height="250">
          <el-table-column min-width="150">
            <template #header><vp-label zh="开始日期" en="Start Time" /></template>
            <template #default="scope">
              <el-form-item :prop="`eduList[${scope.$index}].ksrq`" :rules="formRules.eduList.ksrq" label-width="auto">
                <el-date-picker style="width:100%" type="date" v-model="scope.row.ksrq" v-if="isEditPage"
                  value-format="YYYY-MM-DD"></el-date-picker>
                <span v-else>{{ scope.row.ksrq }}</span>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column min-width="150">
            <template #header><vp-label zh="截止时间" en="Expiry Time" /></template>
            <template #default="scope">
              <el-form-item :prop="`eduList[${scope.$index}].jsrq`" :rules="formRules.eduList.jsrq" label-width="auto">
                <el-date-picker style="width:100%" type="date" v-model="scope.row.jsrq" v-if="isEditPage"
                  value-format="YYYY-MM-DD"></el-date-picker>
                <span v-else>{{ scope.row.jsrq }}</span>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column min-width="150">
            <template #header><vp-label zh="学校" en="Educational Institution" /></template>
            <template #default="scope">
              <el-form-item :prop="`eduList[${scope.$index}].xy`" :rules="formRules.eduList.xy" label-width="auto">
                <el-input placeholder="" v-model="scope.row.xy" style="width: 100%;" :maxlength="100" v-if="isEditPage">
                </el-input>
                <span v-else>{{ scope.row.xy }}</span>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column min-width="150">
            <template #header><vp-label zh="学制" en="Length Of Schooling" /></template>
            <template #default="scope">
              <el-form-item :prop="`eduList[${scope.$index}].xz`" :rules="formRules.eduList.xz" label-width="auto">
                <el-input placeholder="" v-model="scope.row.xz" style="width: 100%;" :maxlength="100" v-if="isEditPage">
                </el-input>
                <span v-else>{{ scope.row.xz }}</span>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column min-width="150">
            <template #header><vp-label zh="专业" en="Major" /></template>
            <template #default="scope">
              <el-form-item :prop="`eduList[${scope.$index}].zy`" :rules="formRules.eduList.zy" label-width="auto">
                <el-input placeholder="" v-model="scope.row.zy" style="width: 100%;" :maxlength="100" v-if="isEditPage">
                </el-input>
                <span v-else>{{ scope.row.zy }}</span>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column min-width="150">
            <template #header><vp-label zh="附件" en="Attachment" /></template>
            <template #default="scope">
              <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
                @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
            </template>
          </el-table-column>
          <el-table-column align="center" width="100" v-if="isEditPage">
            <template #header>
              <el-button circle @click="handleAddEducation">
                <SvgIcon name="ele-Plus"></SvgIcon>
              </el-button>
            </template>
            <template #default="scope">
              <el-button circle @click="handleDeleteEducation(scope.$index)">
                <SvgIcon name="ele-Minus"></SvgIcon>
              </el-button>
            </template>
          </el-table-column>
        </vp-table>
      </el-row>
    </vp-card>

    <vp-card>
      <template #header><vp-label zh="工作履历" en="Work Experience" /></template>
      <vp-table ref="tableRef" :data="formData.workExpList" row-key="id">
        <el-table-column prop="ksrq" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="开始时间" en="Start Time" /></template>
          <template #default="scope">
            <el-form-item :prop="`workExpList[${scope.$index}].ksrq`" :rules="formRules.workExpList.ksrq"
              label-width="auto">
              <el-date-picker style="width:100%" v-model="scope.row.ksrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ scope.row.ksrq }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="ksrq" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="截止时间" en="Expiry Time" /></template>
          <template #default="scope">
            <el-form-item :prop="`workExpList[${scope.$index}].jsrq`" label-width="auto">
              <el-date-picker style="width:100%" v-model="scope.row.jsrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ scope.row.jsrq }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="gzdw" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="工作单位与部门" en="Company/Department" /></template>
          <template #default="scope">
            <el-form-item :prop="`workExpList[${scope.$index}].gzdw`" label-width="auto">
              <el-input v-if="isEditPage" v-model="scope.row.gzdw" v-trim maxlength="100"></el-input>
              <span v-else>{{ scope.row.gzdw }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="sm" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="岗位/职务" en="Job" /></template>
          <template #default="scope">
            <el-form-item :prop="`workExpList[${scope.$index}].gw`" label-width="auto">
              <el-input v-if="isEditPage" v-model="scope.row.gwzw" v-trim maxlength="100"></el-input>
              <span v-else>{{ scope.row.gwzw }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="sm" min-width="200" show-overflow-tooltip>
          <template #header><vp-label zh="工作内容" en="Work Content" /></template>
          <template #default="scope">
            <el-form-item :prop="`workExpList[${scope.$index}].gznr`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.gznr" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre">{{ scope.row.gznr }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="100">
          <template #header><vp-label zh="附件" en="Attachment" /></template>
          <template #default="scope">
            <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
              @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
          </template>
        </el-table-column>
        <el-table-column align="center" width="100" v-if="isEditPage">
          <template #header>
            <el-button circle @click="handleAddWorkExperience()">
              <SvgIcon name="ele-Plus"></SvgIcon>
            </el-button>
          </template>
          <template #default="scope">
            <el-button circle @click="handleDeleteWorkExperience(scope.$index)">
              <SvgIcon name="ele-Minus"></SvgIcon>
            </el-button>
          </template>
        </el-table-column>
      </vp-table>
    </vp-card>

    <vp-card>
      <template #header><vp-label zh="聘任职称" en="Appointment Title" /></template>
      <vp-table ref="tableRef" :data="formData.titleList" row-key="id">
        <el-table-column prop="prrq" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="聘任日期" en="Appointment Date" /></template>
          <template #default="scope">
            <el-form-item :prop="`titleList[${scope.$index}].prrq`" :rules="formRules.titleList.prrq"
              label-width="auto">
              <el-date-picker style="width:100%" v-model="scope.row.prrq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ scope.row.prrq }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="prqx" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="聘任期限" en="Appointment Term" /></template>
          <template #default="scope">
            <el-form-item :prop="`titleList[${scope.$index}].prqx`" label-width="auto">
              <el-date-picker style="width:100%" v-model="scope.row.prqx" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ scope.row.prqx }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="zc" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="职称" en="Prof. Title" /></template>
          <template #default="scope">
            <el-form-item :prop="`titleList[${scope.$index}].zc`" label-width="auto">
              <el-input v-if="isEditPage" v-model="scope.row.zc" v-trim maxlength="100"></el-input>
              <span v-else>{{ scope.row.zc }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="sqdw" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="聘任单位" en="Organization" /></template>
          <template #default="scope">
            <el-form-item :prop="`titleList[${scope.$index}].sqdw`" label-width="auto">
              <el-input v-if="isEditPage" v-model="scope.row.sqdw" v-trim maxlength="100"></el-input>
              <span v-else>{{ scope.row.sqdw }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="bz" min-width="200" show-overflow-tooltip>
          <template #header><vp-label zh="备注" en="Remarks" /></template>
          <template #default="scope">
            <el-form-item :prop="`titleList[${scope.$index}].bz`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.bz" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre">{{ scope.row.bz }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="100">
          <template #header><vp-label zh="附件" en="Attachment" /></template>
          <template #default="scope">
            <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
              @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
          </template>
        </el-table-column>
        <el-table-column align="center" width="100" v-if="isEditPage">
          <template #header>
            <el-button circle @click="handleAddTitle()">
              <SvgIcon name="ele-Plus"></SvgIcon>
            </el-button>
          </template>
          <template #default="scope">
            <el-button circle @click="handleDeleteTitle(scope.$index)">
              <SvgIcon name="ele-Minus"></SvgIcon>
            </el-button>
          </template>
        </el-table-column>
      </vp-table>
    </vp-card>

    <vp-card>
      <template #header><vp-label zh="培训记录" en="Training Record" /></template>

    </vp-card>


    <vp-card>
      <template #header><vp-label zh="资质证书" en="Qualification Certificate" /></template>
      <el-row>
        <vp-col :span="1">
          <el-form-item>
            <template #label><vp-label zh="基础执照" en="Basic License" align="left" /></template>
            <vp-table ref="tableRef" :data="formData.baseLicenseList" row-key="id">
              <el-table-column prop="nr" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="执照号" en="License No." /></template>
                <template #default="scope">
                  <el-form-item :prop="`baseLicenseList[${scope.$index}].zzh`" :rules="formRules.baseLicenseList.zzh"
                    label-width="auto">
                    <el-input v-if="isEditPage" v-model="scope.row.zzh" v-trim maxlength="100"></el-input>
                    <span v-else>{{ scope.row.zzh }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="lb" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="类别" en="Category" /></template>
                <template #default="scope">
                  <el-form-item :prop="`baseLicenseList[${scope.$index}].baseLicenseCatList`" label-width="auto">
                    <VpDictSelectMulit :lxid="609" :selectedId="scope.row.baseLicenseCatList"
                      @dictMulitSelected="(dicts: any) => { scope.row.baseLicenseCatList = dicts; }" style="width:100%"
                      v-if="isEditPage">
                    </VpDictSelectMulit>
                    <span v-else>{{ scope.row.lb }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="yydj" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="技术英语等级" en="Tech. Eng. Lv." /></template>
                <template #default="scope">
                  <el-form-item :prop="`baseLicenseList[${scope.$index}].yydj`" label-width="auto">
                    <VpDictSelect :lxid="607" :selectedId="scope.row.yydj"
                      @dictSelected="obj => { scope.row.yydj = obj; }" style="width:100%" v-if="isEditPage">
                    </VpDictSelect>
                    <span v-else>{{ scope.row.yydj }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="fzjg" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="发证机构" en="Issued By" /></template>
                <template #default="scope">
                  <el-form-item :prop="`baseLicenseList[${scope.$index}].gzdw`" label-width="auto">
                    <el-input v-if="isEditPage" v-model="scope.row.fzjg" v-trim maxlength="100"></el-input>
                    <span v-else>{{ scope.row.fzjg }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="bfrq" min-width="80" show-overflow-tooltip>
                <template #header><vp-label zh="颁发日期" en="Issue Date" /></template>
                <template #default="scope">
                  <el-form-item :prop="`baseLicenseList[${scope.$index}].bfrq`" label-width="auto">
                    <el-date-picker style="width:100%" v-model="scope.row.bfrq" type="date" v-if="isEditPage"
                      value-format="YYYY-MM-DD"></el-date-picker>
                    <span v-else>{{ scope.row.bfrq }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="bz" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="标注" en="Mark" /></template>
                <template #default="scope">
                  <el-form-item :prop="`baseLicenseList[${scope.$index}].bz`" label-width="auto">
                    <el-input v-if="isEditPage" v-model="scope.row.bz" v-trim maxlength="100"></el-input>
                    <span v-else>{{ scope.row.bz }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column min-width="100">
                <template #header><vp-label zh="附件" en="Attachment" /></template>
                <template #default="scope">
                  <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
                    @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
                </template>
              </el-table-column>
              <el-table-column align="center" width="100" v-if="isEditPage">
                <template #header>
                  <el-button circle @click="handleAddBasicLicense()">
                    <SvgIcon name="ele-Plus"></SvgIcon>
                  </el-button>
                </template>
                <template #default="scope">
                  <el-button circle @click="handleDeleteBasicLicense(scope.$index)">
                    <SvgIcon name="ele-Minus"></SvgIcon>
                  </el-button>
                </template>
              </el-table-column>
            </vp-table>
          </el-form-item>
        </vp-col>
      </el-row>
      <el-row>
        <vp-col :span="1">
          <el-form-item>
            <template #label><vp-label zh="颁发记录" en="Issue Record" align="left" /></template>
            <vp-table ref="tableRef" :data="formData.licenseIssueRecordList" row-key="id">
              <el-table-column prop="bfrq" min-width="80" show-overflow-tooltip>
                <template #header><vp-label zh="颁发日期" en="Issue Date" /></template>
                <template #default="scope">
                  <el-form-item :prop="`licenseIssueRecordList[${scope.$index}].bfrq`"
                    :rules="formRules.licenseIssueRecordList.bfrq" label-width="auto">
                    <el-date-picker style="width:100%" v-model="scope.row.bfrq" type="date" v-if="isEditPage"
                      value-format="YYYY-MM-DD"></el-date-picker>
                    <span v-else>{{ scope.row.bfrq }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="lb" min-width="150" show-overflow-tooltip>
                <template #header><vp-label zh="类别" en="Category" /></template>
                <template #default="scope">
                  <el-form-item :prop="`licenseIssueRecordList[${scope.$index}].lb`" label-width="auto">
                    <VpDictSelect :lxid="609" :selectedId="scope.row.lb" @dictSelected="obj => { scope.row.lb = obj; }"
                      style="width:100%" v-if="isEditPage">
                    </VpDictSelect>
                    <span v-else>{{ scope.row.lb }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column min-width="150">
                <template #header><vp-label zh="附件" en="Attachment" /></template>
                <template #default="scope">
                  <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
                    @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
                </template>
              </el-table-column>
              <el-table-column fixed="right" align="center" width="100" v-if="isEditPage">
                <template #header>
                  <el-button circle @click="handleAddLicenseIssueRecord()">
                    <SvgIcon name="ele-Plus"></SvgIcon>
                  </el-button>
                </template>
                <template #default="scope">
                  <el-button circle @click="handleDeleteLicenseIssueRecord(scope.$index)">
                    <SvgIcon name="ele-Minus"></SvgIcon>
                  </el-button>
                </template>
              </el-table-column>
            </vp-table>
          </el-form-item>
        </vp-col>
      </el-row>

      <el-row>
        <vp-col :span="1">
          <el-form-item>
            <template #label><vp-label zh="机型签署" en="AC  Type Endorsement" align="left" /></template>
            <vp-table ref="tableRef" :data="formData.acTypeEndorsementList" row-key="id">
              <el-table-column prop="jx" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="机型" en="Model" /></template>
                <template #default="scope">
                  <el-form-item :prop="`acTypeEndorsementList[${scope.$index}].jx`"
                    :rules="formRules.acTypeEndorsementList.jx" label-width="auto">
                    <el-input v-if="isEditPage" v-model="scope.row.jx" v-trim maxlength="100"></el-input>
                    <span v-else>{{ scope.row.jx }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="qsrq" min-width="80" show-overflow-tooltip>
                <template #header><vp-label zh="签署日期" en="Issue Date" /></template>
                <template #default="scope">
                  <el-form-item :prop="`acTypeEndorsementList[${scope.$index}].qsrq`" label-width="auto">
                    <el-date-picker style="width:100%" v-model="scope.row.qsrq" type="date" v-if="isEditPage"
                      value-format="YYYY-MM-DD"></el-date-picker>
                    <span v-else>{{ scope.row.qsrq }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="yxq" min-width="80" show-overflow-tooltip>
                <template #header><vp-label zh="有效期" en="Exp. Period" /></template>
                <template #default="scope">
                  <el-form-item :prop="`acTypeEndorsementList[${scope.$index}].yxq`" label-width="auto">
                    <el-date-picker style="width:100%" v-model="scope.row.yxq" type="date" v-if="isEditPage"
                      value-format="YYYY-MM-DD"></el-date-picker>
                    <span v-else>{{ scope.row.yxq }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="bz" min-width="120" show-overflow-tooltip>
                <template #header><vp-label zh="标注" en="Annotation" /></template>
                <template #default="scope">
                  <el-form-item :prop="`acTypeEndorsementList[${scope.$index}].bz`" label-width="auto">
                    <el-input v-if="isEditPage" v-model="scope.row.bz" v-trim maxlength="100"></el-input>
                    <span v-else>{{ scope.row.bz }}</span>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column min-width="100">
                <template #header><vp-label zh="附件" en="Attachment" /></template>
                <template #default="scope">
                  <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
                    @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
                </template>
              </el-table-column>
              <el-table-column align="center" width="100" v-if="isEditPage">
                <template #header>
                  <el-button circle @click="handleAddAcTypeEndorsement()">
                    <SvgIcon name="ele-Plus"></SvgIcon>
                  </el-button>
                </template>
                <template #default="scope">
                  <el-button circle @click="handleDeleteAcTypeEndorsementList(scope.$index)">
                    <SvgIcon name="ele-Minus"></SvgIcon>
                  </el-button>
                </template>
              </el-table-column>
            </vp-table>
          </el-form-item>
        </vp-col>
      </el-row>
    </vp-card>



    <vp-card>
      <template #header><vp-label zh="奖惩" en="Rewards and Punishments" /></template>
      <vp-table ref="tableRef" :data="formData.awardsList" row-key="id">
        <el-table-column prop="prrq" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="类型" en="Type" /></template>
          <template #default="scope">
            <el-form-item :prop="`awardsList[${scope.$index}].lx`" :rules="formRules.awardsList.lx" label-width="auto">
              <el-radio-group v-model="scope.row.lx" v-if="isEditPage">
                <el-radio :label="10" :key="10">{{ "奖励/Reward" }}</el-radio>
                <el-radio :label="20" :key="20">{{ '惩罚/Punishment' }}</el-radio>
              </el-radio-group>
              <span v-else>{{ scope.row.lx == 10 ? "奖励/Reward" : scope.row.lx == 20 ? "惩罚/Punishment" : "" }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="rq" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="日期" en="Expiry Time" /></template>
          <template #default="scope">
            <el-form-item :prop="`awardsList[${scope.$index}].rq`" label-width="auto">
              <el-date-picker style="width:100%" v-model="scope.row.rq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ scope.row.rq }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="sjms" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="事件描述" en="Event Desc." /></template>
          <template #default="scope">
            <el-form-item :prop="`awardsList[${scope.$index}].sjms`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.sjms" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre"> {{ scope.row.sjms }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="jcqk" min-width="200" show-overflow-tooltip>
          <template #header><vp-label zh="奖惩说明" en="Explanation" /></template>
          <template #default="scope">
            <el-form-item :prop="`awardsList[${scope.$index}].jcqk`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.jcqk" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre">{{ scope.row.jcqk }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="100">
          <template #header><vp-label zh="附件" en="Attachment" /></template>
          <template #default="scope">
            <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
              @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
          </template>
        </el-table-column>
        <el-table-column align="center" width="100" v-if="isEditPage">
          <template #header>
            <el-button circle @click="handleAddAwards()">
              <SvgIcon name="ele-Plus"></SvgIcon>
            </el-button>
          </template>
          <template #default="scope">
            <el-button circle @click="handleDeleteAwards(scope.$index)">
              <SvgIcon name="ele-Minus"></SvgIcon>
            </el-button>
          </template>
        </el-table-column>
      </vp-table>
    </vp-card>

    <vp-card>
      <template #header><vp-label zh="工作作风" en="Work style" /></template>
      <vp-table ref="tableRef" :data="formData.workStyleList" :rules="formRules.workStyleList.rq" row-key="id">
        <el-table-column prop="rq" min-width="100" show-overflow-tooltip>
          <template #header><vp-label zh="日期" en="Date" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].rq`" label-width="auto">
              <el-date-picker style="width:100%" v-model="scope.row.rq" type="date" v-if="isEditPage"
                value-format="YYYY-MM-DD"></el-date-picker>
              <span v-else>{{ scope.row.rq }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="kf" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="扣分" en="Point Deduction" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].kf`" label-width="auto">
              <el-input-number v-if="isEditPage" :min="0" v-model="scope.row.kf" />
              <span v-else> {{ scope.row.kf }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="dd" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="地点" en="Address" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].dd`" label-width="auto">
              <el-input v-if="isEditPage" v-model="scope.row.dd" v-trim maxlength="100"></el-input>
              <span v-else> {{ scope.row.dd }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="sjry" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="涉事人员" en="Involved Personnel" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].sjry`" label-width="auto">
              <el-input v-if="isEditPage" v-model="scope.row.sjry" v-trim maxlength="100"></el-input>
              <span v-else> {{ scope.row.sjry }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="sjjg" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="事件经过" en="Event Process" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].sjjg`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.sjjg" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre"> {{ scope.row.sjjg }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="hg" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="后果" en="Consequences" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].hg`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.hg" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre"> {{ scope.row.hg }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="dcjl" min-width="120" show-overflow-tooltip>
          <template #header><vp-label zh="调查结论" en="Investigation Conclusion" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].dcjl`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.dcjl" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre"> {{ scope.row.dcjl }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column prop="bz" min-width="200" show-overflow-tooltip>
          <template #header><vp-label zh="备注" en="Attachment" /></template>
          <template #default="scope">
            <el-form-item :prop="`workStyleList[${scope.$index}].bz`" label-width="auto">
              <el-input type="textarea" v-if="isEditPage" v-model="scope.row.bz" v-trim maxlength="1000"></el-input>
              <span v-else style="white-space:pre">{{ scope.row.bz }}</span>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column min-width="100">
          <template #header><vp-label zh="附件" en="Remark" /></template>
          <template #default="scope">
            <RowAttachment :attachmentList="scope.row.attachments" :readOnly="type == 'view'"
              @attachmentListEmit="getAttachmentListEmit($event, scope.row)"></RowAttachment>
          </template>
        </el-table-column>
        <el-table-column align="center" width="100" v-if="isEditPage">
          <template #header>
            <el-button circle @click="handleAddWorkStyle()">
              <SvgIcon name="ele-Plus"></SvgIcon>
            </el-button>
          </template>
          <template #default="scope">
            <el-button circle @click="handleDeleteWorkStyle(scope.$index)">
              <SvgIcon name="ele-Minus"></SvgIcon>
            </el-button>
          </template>
        </el-table-column>
      </vp-table>
    </vp-card>

    <VpFileListCard :attachmentList="formData.attachments" @attachmentListEmit="getAttachmentListEmit($event, formData)"
      :readOnly="!(isEditPage)">
      <template #header>
        <vp-label zh="附件" en="Attachment" />
      </template>
    </VpFileListCard>
  </el-form>
  <VpUserDialog ref="userDialogRef"></VpUserDialog>
  <DepartmentDialog ref="departmentDialogRef" @departmentConfirmed="departmentConfirmed"></DepartmentDialog>

  <BasedataModelMultDialog ref="basedataModelMultDialogRef" @confirm="basedataModelMultConfirm">
  </BasedataModelMultDialog>
</template>
<script setup lang="ts" name="personnelFile">
import { defineAsyncComponent, onMounted, ref, watch, computed } from "vue";
import request from "/@/utils/request";
import validateUtils from "/@/utils/validateUtils";
import VpDictSelect from '/@/components/vp/dict/VpDictSelect.vue';
import VpFileListCard from '/@/components/vp/file/VpFileListCard.vue';
import VpDictSelectMulit from '/@/components/vp/dict/VpDictSelectMulit.vue';
import RowAttachment from '/@/components/vp/file/VpRowAttachment.vue';


const VpUserDialog = defineAsyncComponent(() => import('/@/components/vp/user/VpUserDialog.vue'));
const DepartmentDialog = defineAsyncComponent(() => import('/@/components/vp/department/VpDepartmentDialog.vue'));
const BasedataModelMultDialog = defineAsyncComponent(() => import('/@/components/vp/basedata/basedataModelMultDialog.vue'));


import VpBaseSelectTree from '/@/components/vp/base/VpBaseSelectTree.vue';

const emits = defineEmits(['formSubmited']);

const formData = ref({
  id: "",
  zt: null,
  nwbs: null,
  bh: "",
  yhid: "",
  xm: "",
  xb: 10,
  hyzk: null,
  csrq: "",
  gj: "",
  zzmm: "",
  lxdh: "",
  sfzh: "",
  jdid: "",
  bmid: "",
  bm: "",
  cjgzrq: "",
  rhrq: "",
  rzrq: "",
  lzrq: "",
  zzzt: null,
  bysj: "",
  xl: "",
  xw: "",
  yydj: "",
  zc: "",
  xrzw: "",
  bz: "",
  zpid: "",
  fjglid: "",
  attachments: [],

  //机型培训
  acTypeJxpxList: [],
  //机型签署
  acTypeJxqsList: [],

  eduList: [] as any[],
  workExpList: [] as any[],
  titleList: [] as any[],
  baseLicenseList: [] as any[],
  licenseIssueRecordList: [] as any[],
  acTypeEndorsementList: [] as any[],
  awardsList: [] as any[],
  workStyleList: [] as any[],

  zp: {
    id: '',
    base64: ''
  },
});
const formRules = {
  bh: [
    validateUtils.notNull,
  ],
  xm: [
    validateUtils.notNull
  ],
  nwbs: [
    validateUtils.notNull
  ],
  xb: [
    validateUtils.notNull
  ],
  zzzt: [
    validateUtils.notNull
  ],

  eduList: {
    ksrq: [validateUtils.notNull],
    jsrq: [validateUtils.notNull],
    xy: [validateUtils.notNull],
    zy: [validateUtils.notNull],
    xz: [validateUtils.notNull],
  },
  workExpList: {
    ksrq: [validateUtils.notNull],
  },
  titleList: {
    prrq: [validateUtils.notNull],
  },
  baseLicenseList: {
    zzh: [validateUtils.notNull,]
  },
  licenseIssueRecordList: {
    bfrq: [validateUtils.notNull,]
  },
  acTypeEndorsementList: {
    jx: [validateUtils.notNull,]
  },
  awardsList: {
    lx: [validateUtils.notNull]
  },
  workStyleList: {
    rq: [validateUtils.notNull]
  },

}

const initFormData = () => {
  formData.value = {
    id: "",
    zt: null,
    nwbs: null,
    bh: "",
    yhid: "",
    xm: "",
    xb: 10,
    hyzk: null,
    csrq: "",
    gj: "",
    zzmm: "",
    lxdh: "",
    sfzh: "",
    jdid: "",
    bmid: "",
    bm: "",
    cjgzrq: "",
    rhrq: "",
    rzrq: "",
    lzrq: "",
    zzzt: null,
    bysj: "",
    xl: "",
    xw: "",
    yydj: "",
    zc: "",
    xrzw: "",
    bz: "",
    zpid: "",
    fjglid: "",
    attachments: [],

    //机型培训
    acTypeJxpxList: [],
    //机型签署
    acTypeJxqsList: [],

    eduList: [] as any[],
    workExpList: [] as any[],
    titleList: [] as any[],
    baseLicenseList: [] as any[],
    licenseIssueRecordList: [] as any[],
    acTypeEndorsementList: [] as any[],
    awardsList: [] as any[],
    workStyleList: [] as any[],

    zp: {
      id: '',
      base64: ''
    },
  }
}

const type = ref('add');
const loading = ref(false);
const formRef = ref();
const userDialogRef = ref();
const departmentDialogRef = ref();

const props = defineProps<{
  id: string,
  type: string,
}>()

onMounted(() => {
  handleOpen(props.type, props.id);
})

// 是否是编辑页面
const isEditPage = computed(() => {
  return props.type === 'add' || props.type === 'edit' || props.type === 'editQulity';
});

const wxjlYear = ref(0);
//监听formData.rhrq的值的变化，计算距离多少年
watch(() => formData.value.rhrq, (newValue) => {
  if (newValue) {
    const date = new Date(newValue);
    const now = new Date();
    const diff = now.getTime() - date.getTime();
    const year = Math.floor(diff / (1000 * 60 * 60 * 24 * 365));
    if (year < 0) {
      wxjlYear.value = 0;
    } else {
      wxjlYear.value = year;
    }
  }
});

const handleOpen = (_type: string, id: string) => {
  type.value = _type;
  initFormData();
  if (type.value != "add") {
    loading.value = true;
    request.get(`/training/personnelFile/${id}`).then((res) => {
      formData.value = {
        ...formData.value,
        ...res.data,
      };
      if (formData.value.zpid) {
        request.get(`/file/base64/${formData.value.zpid}`).then(res => {
          if (res.data) {
            formData.value.zp.base64 = res.data
          }
        });
      }
      loading.value = false;
      emits("formSubmited", formData.value);
    });
  }
}

const chooseUserHandle = () => {
  userDialogRef.value.handleOpen({
    type: 1, // 1、选择人员t_user 2、选择档案b_p3_001
    multi: false,    // 是否多选
    selected: formData.value.yhid, // 默认选中人员id
    callback: (data: any) => {
      request.get("/system/user/oneAllInfo/" + data.yhid).then((res: any) => {
        let item = res.data;

        formData.value.yhid = item.id;
        formData.value.xm = item.realname;
        formData.value.jdid = item.jddm;
        formData.value.xrzw = item.zw;
        formData.value.lxdh = item.cellphone;
        formData.value.xb = item.sex;

        formData.value.bmid = data.bmdm;
        formData.value.bm = data.bmmc;
      });
    }
  });
}

const chooseDepartment = () => {
  departmentDialogRef.value.handleOpen(formData.value.bmid);
}

const departmentConfirmed = (data: any) => {
  formData.value.bmid = data.id;
  formData.value.bm = data.dprtname;
}

const basedataModelMultDialogRef = ref();
const modelType = ref();
const basedataModelMultConfirm = (data: any) => {
  if (modelType.value == 1) {
    formData.value.acTypeJxpxList = data.map((item: any) => item.jx);
  } else if (modelType.value == 2) {
    formData.value.acTypeJxqsList = data.map((item: any) => item.jx);
  }
}

const handleChooseBaseDataModelMult = (type: number) => {
  modelType.value = type;
  basedataModelMultDialogRef.value.handleOpen();
}

//教育经历
const handleAddEducation = () => {
  formData.value.eduList.push({
    id: "",
    mainid: "",
    ksrq: "",
    jsrq: "",
    xy: "",
    zy: "",
    xz: "",
    fjglid: "",
    attachments: []
  });
}
const handleDeleteEducation = (index: number) => {
  formData.value.eduList.splice(index, 1);
}
//工作经历
const handleAddWorkExperience = () => {
  formData.value.workExpList.push({
    id: "",
    mainid: "",
    ksrq: "",
    jsrq: "",
    gzdw: "",
    gw: "",
    gznr: "",
    fjglid: "",
    attachments: []
  });
}

const handleDeleteWorkExperience = (index: number) => {
  formData.value.workExpList.splice(index, 1);
}

//聘任职称
const handleAddTitle = () => {
  formData.value.titleList.push({
    id: "",
    mainid: "",
    zc: "",
    sqdw: "",
    prrq: "",
    prqx: "",
    bz: "",
    fjglid: "",
    attachments: []
  });
}

const handleDeleteTitle = (index: number) => {
  formData.value.titleList.splice(index, 1);
}

//基础执照
const handleAddBasicLicense = () => {
  formData.value.baseLicenseList.push({
    id: "",
    mainid: "",
    zzh: "",
    fzjg: "",
    bfrq: "",
    yydj: "",
    bz: "",
    fjglid: "",
    attachments: [],
    baseLicenseCatList: []
  });
}
const handleDeleteBasicLicense = (index: number) => {
  formData.value.baseLicenseList.splice(index, 1);
}
//颁发记录
const handleAddLicenseIssueRecord = () => {
  formData.value.licenseIssueRecordList.push({
    id: "",
    mainid: "",
    bfrq: "",
    lb: "",
    fjglid: "",
    attachments: []
  });
}
const handleDeleteLicenseIssueRecord = (index: number) => {
  formData.value.licenseIssueRecordList.splice(index, 1);
}

//机型签署
const handleAddAcTypeEndorsement = () => {
  formData.value.acTypeEndorsementList.push({
    id: "",
    mainid: "",
    jx: "",
    qsrq: "",
    yxq: "",
    bz: "",
    fjglid: "",
    attachments: []
  });
}
const handleDeleteAcTypeEndorsementList = (index: number) => {
  formData.value.acTypeEndorsementList.splice(index, 1);
}

//奖惩
const handleAddAwards = () => {
  formData.value.awardsList.push({
    id: "",
    mainid: "",
    lx: "",
    rq: "",
    sjms: "",
    jcqk: "",
    fjglid: "",
    attachments: []
  });
}
const handleDeleteAwards = (index: number) => {
  formData.value.awardsList.splice(index, 1);
}


//工作作风
const handleAddWorkStyle = () => {
  formData.value.workStyleList.push({
    id: "",
    mainid: "",
    rq: "",
    dd: "",
    sjry: "",
    sjjg: "",
    hg: "",
    dcjl: "",
    kf: 0,
    bz: "",
    fjglid: "",
    attachments: []
  });
}
const handleDeleteWorkStyle = (index: number) => {
  formData.value.workStyleList.splice(index, 1);
}

const getAttachmentListEmit = (list: any, row: any) => {
  row.attachments = list;
}

// 上传文件之前的方法
const beforeUploadImg = (file: any) => {
  if (file) {
    let submitData = new FormData();
    submitData.append("file", file);
    loading.value = true;
    request.post(`/file/upload`, submitData, {
      headers: {
        'content-type': 'multipart/form-data'
      }
    }).then(res => {
      loading.value = false;
      formData.value.zpid = res.data[0].id;
      request.get(`/file/base64/${formData.value.zpid}`).then(res => {
        if (res.data) {
          formData.value.zp.base64 = res.data
        }
      });
    });
  }
  return false;
}

// 移除图片
const removePicture = () => {
  formData.value.zp = {} as any
}

// 选择基地后回调事件
const handleBaseSelected = (data: any) => {
  formData.value.jdid = data.id;
}

const getData = (zt: number): Promise<any> => {
  let promise = new Promise((resolve, reject) => {
    formRef.value.validate((valid: boolean) => {
      if (valid) {
        resolve({
          ...formData.value,
        });
      } else {
        reject();
      }
    })
  })
  return promise;
};


defineExpose({
  getData
})

</script>
<style scoped>
:deep(.row-warning1) {
  color: var(--el-color-danger);
}
</style>